package cn.tansanqinger.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.tansanqinger.service.IMenuService;
import cn.tansanqinger.service.account.IAccountDataService;

@Controller()
@RequestMapping("/admin")
public class IndexController {
	
	@Autowired
	private IMenuService menu;
	
	@Autowired
	private IAccountDataService accountService;
	
	@RequestMapping("/index")
	public ModelAndView index(ModelAndView mv) {
		mv.setViewName("index");
		mv.addObject("menuList", menu.selectMenuAll());
		return mv;
	}
	
	@RequestMapping("/tab")
	public ModelAndView tab(ModelAndView mv) {
		mv.setViewName("tab");
		return mv;
	}
	
	@RequestMapping("/login_default")
	public ModelAndView login_default(ModelAndView mv) {
		mv.addObject("default", accountService.selectDefaultAmount());
		mv.addObject("selectDefaultNumber", accountService.selectDefaultNumber());
		mv.setViewName("default");
		return mv;
	}
	
	@RequestMapping("/getUname")
	@ResponseBody
	public String getUname() {
		return "管理员";
	}
	
}
